import javax.swing.JOptionPane;
public class TemperatureStabilizer {
		
		public static void main(String[] args) throws DangerouslyHighException, DangerouslyLowException{
			String input="";
			int temp=0;
			boolean isContinue=true;
			Temperature myTemp=new Temperature();
			
			while(isContinue){
				
		
			input=JOptionPane.showInputDialog(null, "Temperature Stabilizer ready to read temperature (normal 200-300k):");
			temp=Integer.parseInt(input);
			
			
			try {
				myTemp.setTemp(temp);
			} catch (DangerouslyHighException dhe) {
				JOptionPane.showMessageDialog(null, dhe.getMessage());
				JOptionPane.showMessageDialog(null, "Highest temperature recorded in this session was"+myTemp.getHigh());
				JOptionPane.showMessageDialog(null, "Lowest temperature recorded in this session was"+myTemp.getLow());
				isContinue=false;
				
			} catch (DangerouslyLowException dle) {
				JOptionPane.showMessageDialog(null, dle.getMessage());
				JOptionPane.showMessageDialog(null, "Highest temperature recorded in this session was"+myTemp.getHigh());
				JOptionPane.showMessageDialog(null, "Lowest temperature recorded in this session was"+myTemp.getLow());
				isContinue=false;
			
			}
			
			
			
			
			}
			
			
		}
}
